function formatDate(date) {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const weekDay = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][date.getDay()]

  return {
    year,
    month: month < 10 ? '0' + month : month,
    day: day < 10 ? '0' + day : day,
    weekDay
  }
}

module.exports = {
  formatDate
};